Skip to content

Conversation

henrygr
Copy link
Member

@henrygr henrygr commented Oct 25, 2026 •

Changes

  • Bump Postgres from 16 to 18 (docker image and setup-db.sh)
  • Switch id defaults from gen_random_uuid() to uuidv7() — v7 combines a 48-bit timestamp with random bits, which aids database indexing
  • Change opening hours and limitation time ranges from Timestamptz to Timetz, as storing a date in these rows was unnecessary
  • Add Prisma migration for the schema changes
  • Reformat schema.prisma for consistent column alignment
  • Make the deploy workflow trigger manually (workflow_dispatch) until prod Postgres is updated to 18 — uuidv7() was introduced in Postgres 18, and a migration attempted before the update would fail and leave the generated types mismatched with the actual database schema
  • Add an "Apply database migrations" step to the deploy workflow

IMPORTANT:

  • run docker compose down -v and then docker compose up -d to create a new container with the updated postgres version

Update ids to use UUIDv7 to improve database indexing, as v7 combines a 48 bit timestamp and random bits to aid in database indexing

Update opening hours and limitation time ranges to use only timetz as having a date in the rows was unnecessary
@henrygr henrygr self-assigned this Oct 25, 2026
@henrygr henrygr marked this pull request as ready for review October 25, 2026 21:49
@henrygr henrygr requested a review from a team as a code owner October 25, 2026 21:49
…postgres

This is to prevent a scenario where a database migration is attempted before postgres is updated from 16 to 18, as "uuidv7()" was introduced with postgres 18 - the command would simply fail and the database would keep running, but this would mean the generated types would be mismatched with the actual database scema
@henrygr henrygr merged commit eaeca91 into main Oct 27, 2026
1 check passed
@henrygr henrygr deleted the update-postgres branch October 27, 2026 17:44
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants